package portal.manager.data;

import java.beans.BeanDescriptor;
import java.beans.PropertyDescriptor;
import java.sql.Types;

import org.bsc.bean.AbstractManagedBeanInfo;
import org.bsc.bean.BeanDescriptorEntity;
import org.bsc.bean.PropertyDescriptorField;
import org.bsc.bean.PropertyDescriptorPK;

public class TemplateBeanInfo extends AbstractManagedBeanInfo<Template> {

	
	protected TemplateBeanInfo(Class<? extends Template> beanClass) {
		super(beanClass);
	}

	public TemplateBeanInfo() {
		super(Template.class);
	}

	public BeanDescriptor getBeanDescriptor() {
        return new BeanDescriptorEntity(getBeanClass(), "TEMPLATE");
	}

	public PropertyDescriptor[] getPropertyDescriptors() {
		try {
			return new PropertyDescriptor[] {
					
					new PropertyDescriptorPK("name", getBeanClass(), "getName", "setName" )
						.setSQLType(Types.VARCHAR)
						.setSize(200),
					new PropertyDescriptorField("source", getBeanClass(), "getSource", "setSource" )
						.setSize(255),
					new PropertyDescriptor( "variableArray", getBeanClass(), "getVariableArray", null )	
			};
		} catch (Exception ex) {
            throw new IllegalStateException(ex);
			
		}
	}

}
